﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

class CopyFolder
{
    public static void CopyDirectory(string source, string destination)
    {
        if (!Directory.Exists(destination))
        {
            Directory.CreateDirectory(destination);
        }

        if (!Directory.Exists(source))
        {
            throw new DirectoryNotFoundException("Directory doesn't exist!");
        }

        DirectoryInfo dirSource = new DirectoryInfo(source);
        DirectoryInfo dirDestin = new DirectoryInfo(destination);

        Directory.CreateDirectory(dirDestin.FullName + @"\" + dirSource.Name);

        foreach (FileInfo file in dirSource.GetFiles())
        {
            file.CopyTo(Path.Combine(dirDestin.FullName + @"\" + dirSource.Name, file.Name));
        }

        foreach (DirectoryInfo dir in dirSource.GetDirectories())
        {
            CopyDirectory(dir.FullName, dirDestin.FullName + @"\" + dirSource.Name);
        }
    }

    static void Main()
    {
        CopyDirectory(@"C:\TEST\ToCopy\smtch", @"C:\TEST\copied");
    }
}
